package com.ctgu.蓝桥杯真题.B组2020第2场;

import java.io.*;

/**
 * @author: Backdiy
 * @data: 2021/4/6 19:06
 * @desc:
 */
public class B寻找2020 {
    public static void main(String[] args) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream("C:\\Users\\20461\\Desktop\\JB\\2020.txt")));
        int maxi = 300;
        int maxj = 300;
        String[] strings = new String[maxi];
        for (int i = 0; i < maxi; i++) {
            strings[i] = bufferedReader.readLine();
        }

        int ans = 0;
        for (int i = 0; i < maxi; i++) {
            for (int j = 0; j < maxj; j++) {
                if (strings[i].charAt(j) == '2') {
                    if (j + 1 < maxj && strings[i].charAt(j + 1) == '0') {
                        if (j + 2 < maxj && strings[i].charAt(j + 2) == '2') {
                            if (j + 3 < maxj && strings[i].charAt(j + 3) == '0') {
                                ans++;
                            }
                        }
                    }
                    if (i + 1 < maxi && strings[i + 1].charAt(j) == '0') {
                        if (i + 2 < maxi && strings[i + 2].charAt(j) == '2') {
                            if (i + 3 < maxi && strings[i + 3].charAt(j) == '0') {
                                ans++;
                            }
                        }
                    }
                    if (i + 1 < maxi && j + 1 < maxj && strings[i + 1].charAt(j + 1) == '0') {
                        if (i + 2 < maxi && j + 2 < maxj && strings[i + 2].charAt(j + 2) == '2') {
                            if (i + 3 < maxi && j + 3 < maxj && strings[i + 3].charAt(j + 3) == '0') {
                                ans++;
                            }
                        }
                    }
                }
            }
        }
        Input.out.println(ans);
        Input.out.flush();
    }

    static class Input {
        static StreamTokenizer streamTokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        static PrintWriter out = new PrintWriter((new OutputStreamWriter(System.out)));
        static BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        static int nextInt() throws IOException {
            streamTokenizer.nextToken();
            return (int) streamTokenizer.nval;
        }

        static double nextDouble() throws IOException {
            streamTokenizer.nextToken();
            return streamTokenizer.nval;
        }

        static long nextLong() throws IOException {
            streamTokenizer.nextToken();
            return (long) streamTokenizer.nval;
        }

        static String nextLine() throws IOException {
            return bufferedReader.readLine();
        }

        static char next() throws IOException {
            return (char) bufferedReader.read();
        }
    }
}


